
clear all

/// Change the directories here
global path "J:\Staff Areas\ks1779\Research\Projects\Project - Nonparticipation\Replication Package\Main\CEB_individual" 
cd "J:\Staff Areas\ks1779\Research\Projects\Project - Nonparticipation\Replication Package\Main\CEB_individual" 


import delimited using "$path\DataPSID_results_cebs_individual_size100_iter100_Cluster1.txt"
rename v14 Q

gen sharem_avg = 0.5*(sharem_min + sharem_max)
gen sharef_avg = 0.5*(sharef_min + sharef_max)

label variable sharem_avg "(midpoint of) Male CEB"
label variable sharef_avg "(midpoint of) Female CEB"

label define edu 1 "Low education" 2 "High education"
label values edum edu
label values eduf edu


***************** FIGURES CEB ******************
*FIGURE 9: (midpoint) CEBs by marital status and education
gen typem = 10*couple + edum
gen typef = 10*couple + eduf

binsreg sharem_avg leisurem if !singlefemale, by(typem) polyreg(4) bycolors(edkblue%45 edkblue%75 cranberry%45 cranberry%75) savedata(result) graphregion(color(white)) bgcolor(white) replace ///
legend(order(1 "Single male, low education" 3 "Single male, high education" 5 "Married male, low education" 7 "Married male, high education") size(medium) pos(6) col(2)) ytitle(Male CEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(400(200)1200, nogrid labsize(medium))
graph export "$path/graphs/ceb_leisure_male_edu_all.png", replace

binsreg sharef_avg leisuref if !singlemale, by(typef) polyreg(4) bycolors(edkblue%45 edkblue%75 cranberry%45 cranberry%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Single female, low education" 3 "Single female, high education" 5 "Married female, low education" 7 "Married female, high education") size(medium) pos(6) col(2)) ytitle(Female CEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(400(200)1200, nogrid labsize(medium))
graph export "$path/graphs/ceb_leisure_female_edu_all.png", replace



***************** FIGURES RICEB ******************
gen ricebm_min = sharem_min/(q + Q)
gen ricebm_max = sharem_max/(q + Q)
gen ricebf_min = sharef_min/(q + Q)
gen ricebf_max = sharef_max/(q + Q)

gen ricebm_avg = 0.5*(ricebm_min + ricebm_max)
gen ricebf_avg = 0.5*(ricebf_min + ricebf_max)

label variable ricebm_avg "(midpoint of) Male RICEB"
label variable ricebf_avg "(midpoint of) Female RICEB"

gen male_emp = 1 if empym == 1 & !singlefemale
replace male_emp = 0 if empym != 1 & !singlefemale

gen female_emp = 1 if empyf == 1 & !singlemale
replace female_emp = 0 if empyf != 1 & !singlemale


*FIGURE 2: (midpoint) RICEB vs. leisure by education
binsreg ricebm_avg leisurem if couple, by(edum) polyreg(4) bycolors(dknavy%65 dkorange%65) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Male RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_leisure_male_edu.png", replace
graph export "$path/graphs/riceb_leisure_male_edu.pdf", replace

binsreg ricebf_avg leisuref if couple, by(eduf) polyreg(4) bycolors(dknavy%65 dkorange%65) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Female RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_leisure_female_edu.png", replace
graph export "$path/graphs/riceb_leisure_female_edu.pdf", replace


*FIGURES 5 & 6 (lower bound) RICEB vs. leisure by education
binsreg ricebm_min leisurem if couple, by(edum) polyreg(4) bycolors(cranberry%45 cranberry%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Lower bound male RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/min_riceb_leisure_male_edu.png", replace

binsreg ricebf_min leisuref if couple, by(eduf) polyreg(4) bycolors(cranberry%45 cranberry%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Lower bound female RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/min_riceb_leisure_female_edu.png", replace


*FIGURES 5 & 6 (upper bound) RICEB vs. leisure by education
binsreg ricebm_max leisurem if couple, by(edum) polyreg(4) bycolors(edkblue%45 edkblue%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Upper bound male RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/max_riceb_leisure_male_edu.png", replace

binsreg ricebf_max leisuref if couple, by(eduf) polyreg(4) bycolors(edkblue%45 edkblue%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Upper bound female RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/max_riceb_leisure_female_edu.png", replace


*FIGURE 7 (midpoint) RICEB vs. housework by education
binsreg ricebm_avg hworkm if couple, by(edum) polyreg(4) bycolors(orange_red%45 orange_red%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Male RICEB, size(medium)) xtitle(Housework, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_hwork_male_edu.png", replace

binsreg ricebf_avg hworkf if couple, by(eduf) polyreg(4) bycolors(orange_red%45 orange_red%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Low education" 3 "High education") pos(6) col(2) size(medium)) ytitle(Female RICEB, size(medium)) xtitle(Housework, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_hwork_female_edu.png", replace


*FIGURE 8 (midpoint) RICEB vs. leisure by employment
binsreg ricebm_avg leisurem if couple, by(male_emp) polyreg(4) bycolors(emerald%45 emerald%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Unemployed" 3 "Employed") pos(6) col(2) size(medium)) ytitle(Male RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_leisure_male_empy.png", replace

binsreg ricebf_avg leisuref if couple, by(female_emp) polyreg(4) bycolors(emerald%45 emerald%75) savedata(result) graphregion(color(white)) bgcolor(white)  replace ///
legend(order(1 "Unemployed" 3 "Employed") pos(6) col(2) size(medium)) ytitle(Female RICEB, size(medium)) xtitle(Leisure, size(medium)) xlabel(, nogrid labsize(medium)) ylabel(0.4(0.2)1, nogrid labsize(medium))
graph export "$path/graphs/riceb_leisure_female_empy.png", replace



***************** FIGURES POVERTY ANALYSIS ******************
gen consumption = q + Q
gen percapita_consumption = consumption if couple == 0
replace percapita_consumption = 0.5*consumption if couple == 1

local povline_consumption = 350.41
gen poor_classm = 1 if sharem_avg >= `povline_consumption' & percapita_consumption >= `povline_consumption'
replace poor_classm = 2 if sharem_avg >= `povline_consumption' & percapita_consumption < `povline_consumption'
replace poor_classm = 3 if sharem_avg < `povline_consumption' & percapita_consumption >= `povline_consumption'
replace poor_classm = 4 if sharem_avg < `povline_consumption' & percapita_consumption < `povline_consumption'
 
gen poor_classf = 1 if sharef_avg >= `povline_consumption' & percapita_consumption >= `povline_consumption'
replace poor_classf = 2 if sharef_avg >= `povline_consumption' & percapita_consumption < `povline_consumption'
replace poor_classf = 3 if sharef_avg < `povline_consumption' & percapita_consumption >= `povline_consumption'
replace poor_classf = 4 if sharef_avg < `povline_consumption' & percapita_consumption < `povline_consumption'


*FIGURE 1 
local povline_consumption = 350.41
twoway ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Male CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_male_zoomed.png", replace
graph export "$path/graphs/misclassification_male_zoomed.pdf", replace


local povline_consumption = 350.41
twoway ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Female CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_female_zoomed.png", replace
graph export "$path/graphs/misclassification_female_zoomed.pdf", replace

 
*FIGURE 3: Males X Education ZOOMED
local povline_consumption = 350.41
twoway ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 1 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 1 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 1 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 1 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 1 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 1 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 1 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 1 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Male CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_male_edulow_zoomed.png", replace

local povline_consumption = 350.41
twoway ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 2 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 2 & poor_classm == 1 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 2 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 2 & poor_classm == 2 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 2 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 2 & poor_classm == 3 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 1 & edum == 2 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharem_avg percapita_consumption if couple & male_emp == 0 & edum == 2 & poor_classm == 4 & sharem_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Male CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_male_eduhigh_zoomed.png", replace


*FIGURE 4: Females X Education ZOOMED

local povline_consumption = 350.41
twoway ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 1 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 1 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 1 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 1 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 1 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 1 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 1 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 1 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Female CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_female_edulow_zoomed.png", replace


local povline_consumption = 350.41
twoway ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 2 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 2 & poor_classf == 1 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 2 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 2 & poor_classf == 2 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 2 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 2 & poor_classf == 3 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(red%40)  msize(small) msymbol(O) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 1 & eduf == 2 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(T) mlwidth(none) || ///
scatter sharef_avg percapita_consumption if couple & female_emp == 0 & eduf == 2 & poor_classf == 4 & sharef_avg < 1000 & percapita_consumption < 1000, mcolor(gray%40) msize(small) msymbol(O) mlwidth(none) ///
ytitle(Female CEB, size(medium)) xtitle(per capita consumption, size(medium)) xlabel(0(200)1000, nogrid labsize(medium)) ylabel(0(200)1000, nogrid labsize(medium)) ///
xline(`povline_consumption',  lwidth(thin) lcolor(maroon) lpattern(solid)) yline(`povline_consumption', lwidth(thin) lcolor(maroon) lpattern(solid)) legend(order(3 "Employed" 4 "Unemlpoyed") pos(6) col(2) size(medium)) text(1000 `povline_consumption' "poverty threshold = $`povline_consumption'", place(w) size(small))
graph export "$path/graphs/misclassification_female_eduhigh_zoomed.png", replace



***************** TIME VS. MATERIAL POVERTY ******************
local povline_consumption = 350.41
local povline_leisure = 34.8

gen poorm_material = 1 if sharem_min < `povline_consumption' & sharem_max < `povline_consumption'
replace poorm_material = 0 if sharem_min >= `povline_consumption' & sharem_max >= `povline_consumption'
replace poorm_material = . if sharem_min < `povline_consumption' & sharem_max >= `povline_consumption'

gen poorm_time = 1 if leisurem < `povline_leisure'
replace poorm_time = 0 if leisurem >= `povline_leisure'

gen poorf_material = 1 if sharef_min < `povline_consumption' & sharef_max < `povline_consumption'
replace poorf_material = 0 if sharef_min >= `povline_consumption' & sharef_max >= `povline_consumption'
replace poorf_material = . if sharef_min < `povline_consumption' & sharef_max >= `povline_consumption'

gen poorf_time = 1 if leisuref < `povline_leisure'
replace poorf_time = 0 if leisuref >= `povline_leisure'



*==================== TABLE 14 =======================*
tab poorm_time poorm_material if couple == 1, cell
tab poorf_time poorf_material if couple == 1, cell
tab poorm_time poorm_material if singlemale == 1, cell
tab poorf_time poorf_material if singlefemale == 1, cell












